import env from "./env";

export default {
  generate: {
    subFolders: false,
  },
  // env: {
  //   baseUrl: env[process.env.NODE_ENV].BASE_API,
  //   NODE_ENV: env[process.env.NODE_ENV].NODE_ENV
  // },

  // Global page headers: https://go.nuxtjs.dev/config-head
  head: {
    title: "业财税移动端",
    htmlAttrs: {
      lang: "en",
    },
    meta: [
      { charset: "utf-8" },
      {
        name: "viewport",
        content:
          "width=device-width, initial-scale=1,maximum-scale=1, user-scalable=no",
      },
      { hid: "description", name: "description", content: "" },
      { name: "format-detection", content: "telephone=no" },
    ],
    link: [{ rel: "icon", type: "image/x-icon", href: "/favicon.ico" }],
    script: [
      {
        src: "https://unpkg.com/@dcloudio/uni-webview-js@0.0.3/index.js",
        type: "text/javascript",
      },
      //以下两个文件同时引入时，注意引入的顺序，微信的需要在前。
      // { src: "https://res.wx.qq.com/open/js/jweixin-1.4.0.js", type: "text/javascript" },
      {
        src: "https://js.cdn.aliyun.dcloud.net.cn/dev/uni-app/uni.webview.1.5.2.js",
        type: "text/javascript",
      },
    ],
  },
  // css: cssList,
  router: {
    middleware: "menu",
  },

  // Global CSS: https://go.nuxtjs.dev/config-css
  css: [
    "element-ui/lib/theme-chalk/index.css",
    "@/assets/main.scss",
    "swiper/css/swiper.css",
    "@/assets/css/tailwind.css",
  ],

  // Plugins to run before rendering page: https://go.nuxtjs.dev/config-plugins
  plugins: [
    "@/plugins/element-ui",
    "@/plugins/vue-resource",
    "@/plugins/vue-touch.client.js",
    "@/plugins/vxe-table.client.js",
    "@/plugins/vue-awesome-swiper.client.js",
    {
      src: "~/plugins/route",
    },
    {
      src: "~/plugins/windowInit",
      ssr: false,
    },
    {
      src: "~/plugins/demo",
      ssr: false,
    },
    {
      src: "~/plugins/vuedraggable",
      ssr: false,
    },
    {
      src: "~/plugins/jspdf",
      ssr: false,
    },
    {
      src: "~/plugins/pdf",
      ssr: false,
    },
    {
      src: "~/plugins/vue-pdf.js",
      ssr: false,
    },
    {
      src: "@/plugins/museui",
      ssr: false,
    },
    {
      src: "@/plugins/driver",
      ssr: false,
    },
    { src: "~/plugins/vuex-persist", ssr: false },
    { src: "~/plugins/d3.js", ssr: false },

    {
      src: "~/plugins/mixins/index",
    },
    {
      src: "@/plugins/axios",
    },
  ],
  styleResources: {
    scss: [
      "./assets/main.scss", // 全局 scss 变量
    ],
  },
  // Auto import components: https://go.nuxtjs.dev/config-components
  components: true,

  // Modules for dev and build (recommended): https://go.nuxtjs.dev/config-modules
  buildModules: [],
  // Modules: https://go.nuxtjs.dev/config-modules
  modules: [
    "@nuxtjs/axios",
    "@nuxtjs/style-resources", // 添加对应的模块
    "@nuxtjs/markdownit",
  ],
  markdownit: {
    preset: "default",
    linkify: true,
    breaks: true,
    runtime: true,
    // 用什么解析插件安装什么解析插件
    // use这里的均需要 npm i进行安装
    use: [
      // "markdown-it-div",
      // "markdown-it-attrs",
      // "markdown-it-highlightjs",
      // "markdown-it-mark",
      // "markdown-it-deflist",
      // "markdown-it-abbr",
      // "markdown-it-footnote",
      // "markdown-it-ins",
      // "markdown-it-sub",
      // "markdown-it-sup",
      // "markdown-it-toc-and-anchor",
      // "markdown-it-task-lists",
      // "markdown-it-katex",
      // "markdown-it-emoji",
    ],
  },

  // Build Configuration: https://go.nuxtjs.dev/config-build
  build: {
    transpile: [/^element-ui/],
    postcss: {
      plugins: {
        tailwindcss: {},
        autoprefixer: {},
      },
    },
  },
  // axios: {
  //   proxy: true,
  //   prefix: '/api',
  //   // credentials: true,
  // },
  proxy: {
    "/api/": {
      target: "https://zhikujiapu.oss-cn-hangzhou.aliyuncs.com", // 代理地址
      // changeOrigin: true,
      pathRewrite: {
        "^/api": "",
      },
    },
  },

  vue: {
    config: {
      productionTip: false,
      devtools: true,
    },
  },
};
